package com.shuiyun.jtt.message.jt808;

import com.shuiyun.jtt.anno.Message;
import com.shuiyun.jtt.enums.JT808;
import com.shuiyun.jtt.message.Header;
import com.shuiyun.jtt.message.JTMessage;
import com.shuiyun.jtt.utils.codec.DataType;
import com.shuiyun.jtt.utils.codec.FieldValue;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * @author shuiyun
 * @description 终端注册应答
 * @date 2022-04-20 00:08
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Message(JT808.终端注册应答0x8100)
public class T8100 extends JTMessage {


    /** 0：成功 */
    public static final int Success = 0;
    /** 1：车辆已被注册 */
    public static final int AlreadyRegisteredVehicle = 1;
    /** 2：数据库中无该车辆 */
    public static final int NotFoundVehicle = 2;
    /** 3：终端已被注册 */
    public static final int AlreadyRegisteredTerminal = 3;
    /** 4：数据库中无该终端 */
    public static final int NotFoundTerminal = 4;

    public T8100(int serialNo, String mobileNo) {
        super(new Header(JT808.终端注册应答0x8100, serialNo, mobileNo));
        this.serialNo = serialNo;
    }


    @FieldValue(type = DataType.WORD, desc = "应答流水号")
    private Integer serialNo;

    @FieldValue(type = DataType.BYTE, desc = "结果")
    private Integer resultCode;

    @FieldValue(type = DataType.STRING, desc = "鉴权码")
    private String token;

}
